<template>
    <header class="crawler-header">
        <section class="box">
            <div class="header-left">
                <a class="logo-wrap"
                    href="/">
                    波维希
                    <img class="img" src="https://oss.boweixi.com/prod/bwx/logo.png"
                        alt="logo" />
                </a>
            </div>
            <nav class="header-center">
                <ul class="ul">
                    <li>
                        <a class="link" href="/report">报告</a>
                    </li>
                    <li>
                        <a class="link" href="/report">博客</a>
                    </li>
                </ul>
            </nav>

            <div class="header-right">
                <div v-if="isLogin">
                    <div class="user-info">{{ userInfo?.nickname }}</div>
                </div>
                <a v-else class="link" href="/login" target="_blank">登录</a>
            </div>
        </section>
    </header>
</template>

<script setup lang="ts">
const isLogin = useState('isLogin')
const userInfo = useState('userInfo')
onMounted(() => {
    // console.log('isLogin', isLogin.value)
    // console.log('userInfo', userInfo.value)
})
</script>
<style lang="scss">
.crawler-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.702);
    backdrop-filter: blur(23px) saturate(4.5);
    box-shadow: 0 0 18px 2px rgba(0, 0, 0, 0.102);

    .box {
        display: flex;
        align-items: center;
        min-height: var(--vc-header-height);
        gap: 30px;
    }

    .header-left {
        .logo-wrap {
            display: flex;
            justify-content: center;
            align-items: center;
            text-indent: -9999px;
            overflow: hidden;
            width: max-content;

            img {
                width: 45px;
                height: auto;
                border-radius: 6px;
            }
        }
    }

    .header-center {
        ul {
            display: flex;
            align-items: center;
            gap: 30px;
        }
    }

    .header-right {
        margin-left: auto;
    }
}
</style>